<template>
    <window class="m-progress-detail am-form-group" ref="win" title="回复内容">
        <div class="am-form-group am-u-lg-12">
            <p class="feed">反馈内容：{{feedback.question}}</p>

            <div class="reply">
                <p >请输入要回复的内容：</p>
                
                <div class="am-form ">
                    <textarea name="" v-model="query.replyContent"></textarea>
                </div>
                <div class="btn">
                    <el-button size="small" @click="updateFeedbackStatus()">短信回复</el-button>
                </div>
            </div>
        </div>
    </window>
</template>
<script>
import io from '../../lib/io'
export default {
    data(){
        return{
            query:{
                replyContent:'',
            },
            feedback:{},
        }
    },
    created(){

    },
    methods:{
        show:function(){
            this.$refs.win.show( { width : 800 } )    
        },
        updateFeedbackStatus(){
            if(!this.query.replyContent){
                this.$alert('请输入回复内容') 
                return 
            }
            let param = {
                outerFeedbackId:this.feedback.outerFeedbackId,
                status:1,
                contact:this.feedback.contact,
                replyContent:this.query.replyContent,
            }
            io.post(io.updateFeedbackStatus,param,(ret)=>{
                if(ret.success){
                    this.$refs.win.close()
                    this.$emit('completed')   
                    this.$toast('回复成功')
                }else{
                    this.$alert(ret.desc)
                }
            })
        }
    },

}
</script>
<style lang="less" scoped>
.feed{
    font-size:14px;
    color:#999;
    text-align: left;
}
.reply{
    text-align:left;
    p{
        font-size:14px;
        color:#333; 
    }
    .btn{
        padding-top:20px;
        text-align: center;
    }
}
</style>
